<template>
    <div style="height:100%">
        <div><el-link type="primary"><i class="el-icon-back" @click="goBack">返回</i></el-link></div>
        <h3 align="center" >{{article.title}}</h3>
        <div style="text-align: right">
            <el-link class="a">{{article.userUtile.nickname}}</el-link>
            <el-link class="a" >浏览量:{{article.views}}</el-link>
            <el-link class="a">{{article.edittime}}</el-link>
        </div>
        <div style="font-size: 14px" v-html="article.htmlContent"></div>
    </div>
</template>

<script>
    export default {
        name: "ArticlDetailed",
        data(){
           return{
              // count:'',
               aid:'',
               article:{
                   userUtile:{
                        nickname:''
                    }
               }
           }
        },
        methods:{
            goBack(){
                this.$router.push('/articlList');
            },
            getArticlsById(){
                this.getRequest('/aticle/getArticlsById?aid='+this.aid).then((resp)=>{
                    if(resp){
                        resp.views++;
                        this.article=resp;
                    }
                })
            },
            updeteCount(){

                    let count=1;
                    this.putRequest('/aticle/updeteCount?count='+count+'&aid='+this.aid).then((resp)=>{
                        if(resp){

                        }
                        else {
                            console.log("sdsds");
                        }
                    })
                }

        },
        mounted(){
           this.aid= this.$route.query.aid;
           this.getArticlsById();
           this.updeteCount();
        },
    }
</script>

<style scoped>
    .a{
        font-size: 12px;
        margin: 0 6px;
    }
</style>